package com.github.limit.fuse.spring.boot.config;

import com.github.limit.interceptor.AccessInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: wangdejun
 * @create: 2019-10-11 16:56
 **/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {


    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(accessInterceptor()).addPathPatterns("/**");

    }

    @Bean
    public AccessInterceptor accessInterceptor() {
        return new AccessInterceptor();
    }


}
